/**
 * com.cnhis.cloudhealth.base.bo.SysParametersBo.java
 */
package com.cnhis.cloudhealth.clinical.medical.base.bo;

import com.cnhis.cloudhealth.clinical.infusion.base.mapper.SysParameters;
import com.cnhis.cloudhealth.clinical.medical.base.dao.MsysParametersDao;
import com.cnhis.cloudhealth.clinical.medical.base.mapper.MParameter;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @file  SysParametersBo.java
 * @author hedongdong
 * @version 0.1
 * @todo	SysParameters业务操作接口
 * Copyright(C), 2013-2014
 *		 Shenzhen Coordinates Software Development Co., Ltd.
 * History
 *   	1. Date: 2016-06-13 02:22:13
 *      	Author: hedongdong
 *      	Modification: this file was created
 *   	2. ...
 */
@Service
public class MsysParametersBo {
	@Resource
	private MsysParametersDao msysParametersDao;

	/**
	 * 查询出所有  参数信息
	 * @return
	 * @throws Exception
	 */
	public List<SysParameters> querySysParameter()throws Exception {
		List<SysParameters> list = new ArrayList<SysParameters>();
		list = msysParametersDao.querySysParameter();
		return list;
	}

	public void updateSysParameterList(List<MParameter> list) throws Exception{
		msysParametersDao.updateSysParameterList(list);
	}

    public Map<String, SysParameters> findParameters(String[] params) throws Exception {
        List<SysParameters> list = msysParametersDao.findParameters(params);
        Map<String, SysParameters> map = new HashMap<>();
        for (SysParameters sysParameters : list) {
            String key = sysParameters.getProductid() + "-" + sysParameters.getProductid() + "-" + sysParameters.getParamno();
            map.put(key, sysParameters);
        }
        return map;
    }
}
